<template>
	<view class="">
		<view class="he1 w100pc"></view>
		<!-- 头部 -->
		<view class="fsb lrmg-40" style="height: 100rpx;">
			<tabbar type="3"></tabbar>
			<view class="flex aic">
				<!-- <image src="/static/image/25.png" style="width:48rpx;height:48rpx" class="" @click="copylink(getLoginInfo.user)"></image> -->
				<!-- <view class="gray272 bold500 f30 over" style="width: 200rpx;">...{{jiequten(getLoginInfo.user)}}</view> -->
				<!-- <view class="bg-272 bra60 fcc rel" style="padding: 15rpx 20rpx;" @click="show = !show">
					<view class="mg-r-10 fff">{{tab[flag]}}</view>
					<image src="/static/image/3.png" style="width:30rpx;height:30rpx" class=""></image>
					<view class="one1 bg-272 bra30" v-if="show">
						<view class="mg-b-30 fcc" v-for="(it,i) in tab" :key="i" @click.stop="dianji(i)">
							<view class="fff mg-r-10">{{it}}</view>
							<image src="/static/image/4.png" style="width:30rpx;height:25rpx" class="" v-if="i == flag"></image>
						</view>
					</view>
				</view> -->
			</view>
		</view>
		<view class="fsb" style="margin: 20rpx 40rpx 0;">
			<view class="flex aic">
				<image src="/static/image/26.png" style="width:90rpx;height:90rpx" mode="aspectFill" class="bra50"></image>
				<view class="mg-l-30">
					<view class="fff">我的等级：{{userInfo.level_name}}</view>
					<view class="f24 mg-t-20" style="color: #959393;">...{{jiequten(getLoginInfo.user)}}</view>
				</view>
			</view>
			<view class="fff bra10" style="padding: 15rpx 40rpx;background: #31B898;" @tap="qiandao">签到</view>
		</view>
		<view class="he3 w100pc"></view>
		<view class="bra20 lrmg-40 fff" style="background: #31B898;padding: 40rpx;">
			<view class="gray333 weight f32">我的资产 <text class="mg-l-10 f26 gray333">(MMST今日价格：$ {{(1 * Number(shouxufei.lcc_exchange)).toFixed(4)}})</text></view>
			<view class="fsa mg-t-40">
				<view class="fdc aic">
					<view class="fdc aic" @tap="pageto('/pages/wode/usdtmx')">
						<view class="f48 weight gray333">{{userInfo.usdt}}</view>
						<view class="mg-t-30" style="color: rgba(51, 51, 51, 0.50);">USDT</view>
					</view>
					<view class="bra10 mg-t-30" style="padding: 20rpx 60rpx;background: #fff;color: #31B898;" @tap="pageto('/pages/wode/zhuanzhang')">内转</view>
				</view>
				<view class="fdc aic">
					<view class="fdc aic" @tap="pageto('/pages/wode/mmstmx')">
						<view class="f48 weight gray333">{{userInfo.lcc}}</view>
						<view class="mg-t-30" style="color: rgba(51, 51, 51, 0.50);">MMST</view>
					</view>
					<view class="bra10 mg-t-30" style="padding: 20rpx 60rpx;background: #fff;color: #31B898;" @tap="pageto('/pages/wode/tixian')">提币</view>
				</view>
			</view>
			
		</view>
		<view class="he3 w100pc"></view>
		<view class="bra20 lrmg-40 fff" style="background: #1B1B1B;padding: 40rpx;">
			<view class="gray272 weight f32 mg-b-30">援助奖励</view>
			<view class="fsa">
				<view class="fdc aic" @tap="pageto('/pages/wode/fenhong')">
					<view class="f38 weight" style="color: #31B898;">{{userInfo.dividend}}</view>
					<view class="mg-t-20 f24 gray272s">分红积分</view>
				</view>
				<view class="fdc aic" @tap="pageto('/pages/wode/jiangli')">
					<view class="f38 weight" style="color: #31B898;">{{userInfo.reward}}</view>
					<view class="mg-t-20 f24 gray272s">援助奖励</view>
				</view>
			</view>
		</view>
		<view class="he3 w100pc"></view>
		<view class="fsb lrmg-40">
			<view class="bra20" style="background: #1B1B1B;padding: 40rpx;width: 45%;">
				<view class="gray272 weight f32 mg-b-30">云算收益</view>
				<view class="fdc aic mg-t-30">
					<view class="f38 weight" style="color: #31B898;">{{userInfo.total_cloud}}</view>
					<view class="mg-t-20 f24 gray272s">当前收益总量</view>
				</view>
			</view>
			<view class="bra20" style="background: #1B1B1B;padding: 40rpx;width: 45%;">
				<view class="gray272 weight f32 mg-b-30">援助基金</view>
				<view class="fdc aic mg-t-30">
					<view class="f38 weight" style="color: #31B898;">{{userInfo.donation}}</view>
					<view class="mg-t-20 f24 gray272s">当前基金总数</view>
				</view>
			</view>
		</view>
		<view class="he4 w100pc"></view>
		<view class="lrmg-40">
			<view class="mg-b-40 fsb" @tap="pageto('/pages/wode/juzhen')">
				<view class="fff f30 weight">矩阵</view>
				<image src="/static/image/11.png" style="width:83rpx;height:48rpx" class=""></image>
			</view>
			<view class="mg-b-40 fsb" @tap="pageto('/pages/wode/fenxiang')">
				<view class="fff f30 weight">分享</view>
				<image src="/static/image/11.png" style="width:83rpx;height:48rpx" class=""></image>
			</view>
		</view>
		<view class="he3 w100pc"></view>
	</view>
</template>

<script>
	var	that
	import tabbar from "../../components/tabbar/tabbar.vue"
	import {
		_updataTabBar,
		pageto
	} from "../../common/js/sysfun.js"
	import {
		mapGetters,
		mapMutations
	} from 'vuex'
	export default{
		data(){
			return{
				statusBar:false,
				tab:['中文繁体','English'],
				flag:0,
				show:false,
				userInfo:{},
				shouxufei:{}
			}
		},
		components:{
			tabbar
		},
		onLoad() {
			that = this
		},
		onShow() {
			if(this.getLangType == 'chs'){
				this.flag = 0
			}else{
				this.flag = 1
			}
			that.getUser()
			that.shouxu()
		},
		computed: {
			i18n() {
				return this.$t('message');
			},
			...mapGetters([
				'getRequestUrl',
				'getLangType',
				'getTextArr',
				'getLoginInfo'
			])
		},
		methods:{
			shouxu(){
				that.$postAjax('api/Finance/finance_config','',function(res){
					console.log(res);
					that.shouxufei = res.data
				})
			},
			//复制邀请链接
			copylink(e) {
				uni.setClipboardData({
					data: e, //只能是字符串
					success: function () {
						uni.showToast({
							title: '复制成功',
							duration: 2000
						});
					}
				});
			},
			qiandao(){
				uni.showLoading({
					mask: true
				});
				that.$postAjax('api/Member/sign','',function(res){
					uni.hideLoading()
					uni.showToast({
						title: '簽到成功！',
						icon: 'none'
					});
				})
			},
			zanwei(){
				uni.showToast({
					title: '暫未開放',
					icon: 'none'
				});
			},
			//截取后10位
			jiequten(e){
				var disName = e;
				var dateLength = disName.length;
				var key = disName.substring(dateLength-10,dateLength);
				return key
			},
			...mapMutations([
				'setGgsxq',
				'setLoginInfo',
				'setLogin',
				'setLoginTime',
				'setLangType',
				'setAreas'
			]),
			getUser(){
				that.$postAjax('api/Member/wallet','',function(res){
					console.log(res);
					that.userInfo = res.data
				})
			},
			dianji(e){
				that.flag = e
				that.show = !that.show
				if(e == 0){
					this.setLangType('chs')
					this.$i18n.locale = 'chs'
					console.log('设置中文');
				}else if(e == 1){
					this.setLangType('en')
					this.$i18n.locale = 'en'
					console.log('设置英文');
				}
				that.getUser()
			},
			geTel(tel){
			    var reg = /^(\d{3})\d{4}(\d{4})$/;  
			    return tel.replace(reg, "$1****$2");
			},
			pageto(url, pp) {
				pageto(url, pp);
			},
		}
	}
</script>

<style lang="scss">
	.one1{
		padding: 30rpx 20rpx 0rpx;
		position: absolute;
		left: 0;
		top: 80rpx;
		z-index: 999;
	}
</style>